package ru.nagakhl.whirlpool.pool;

import org.apache.cassandra.thrift.Cassandra;

import ru.nagakhl.whirlpool.exceptions.PoolException;

/**
 * Pool of connections to cassandra database. For more information see documentation on
 * details of concrete implementation.
 */
public interface BlockingConnectionPool {

	/**
	 * Get connection from pool, blocking calling thread if no connection currently available 
	 */
	public abstract Cassandra.Client getConnection();

	/**
	 * Return connection into pool, notifying waiting (blocked) threads
	 * 
	 * @param cl Connection to return to pool
	 * 
	 * @throws PoolException if something goes wrong
	 */
	public abstract void returnConnection(Cassandra.Client cl) throws PoolException;

}